package com.future.lottie.base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewbinding.ViewBinding;

/**
 * @author xuchuanting
 * Create on 2020/7/16 11:37
 */
public abstract class BaseFragment<B extends ViewBinding> extends Fragment {

    protected B mViewBinding;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mViewBinding = createViewBinding(inflater,container);
        initView();
        initData();
        return mViewBinding.getRoot();
    }

    protected abstract void initData();

    protected abstract void initView();

    protected abstract B createViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup container);
}
